package com.gt.stream

import java.io.{BufferedWriter, OutputStreamWriter}
import java.net.Socket

object TestSocket {
  def main(args: Array[String]): Unit = {

    val socket = new Socket("localhost", 9999)
    val writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream))

    while (true){
      writer.write("a b c")
      println("a b c")
      writer.newLine()
      writer.flush()
      Thread.sleep(2000L)
    }

    writer.close()
    socket.close()
  }

}
